using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using Entities;
using DAL;
using System.Data.SqlClient;
using System.Data;

namespace BUS
{
    public class tbHinhThuc_GiaoDichBUS
    {
        public static void Insert(tbHinhThuc_GiaoDichEntities HTGD)
        {
            tbHinhThuc_GiaoDichDAL HTGDDAL = new tbHinhThuc_GiaoDichDAL();
            HTGDDAL.Insert(HTGD);
        }

        public static void Update(tbHinhThuc_GiaoDichEntities HTGD)
        {
            tbHinhThuc_GiaoDichDAL HTGDDAL = new tbHinhThuc_GiaoDichDAL();
            HTGDDAL.Insert(HTGD);
        }

        public static void Delete(int iD)
        {
            tbHinhThuc_GiaoDichDAL HTGDDAL = new tbHinhThuc_GiaoDichDAL();
            HTGDDAL.Delete(iD);
        }

        public static Entities.tbHinhThuc_GiaoDichEntities.tbHinhThuc_GiaoDichColection Get(string where,int pageindex, int pagesize,string orderby, string orderdirection,out int total)
        {
            tbHinhThuc_GiaoDichDAL HTGDDAL = new tbHinhThuc_GiaoDichDAL();
            return HTGDDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }

        public static Entities.tbHinhThuc_GiaoDichEntities.tbHinhThuc_GiaoDichColection GetAll()
        {
            int total = 0;
            tbHinhThuc_GiaoDichDAL HTGDDAL = new tbHinhThuc_GiaoDichDAL();
            return HTGDDAL.Get("where 1=1", 0, 0, Entities.tbHinhThuc_GiaoDichEntities.tbHinhThuc_GiaoDichColumn.MaGD.ToString(), "ASC", out total);
        }

        public static tbHinhThuc_GiaoDichEntities GetByID(int iD)
        {
            int total = 0;
            tbHinhThuc_GiaoDichDAL HTGDDAL = new tbHinhThuc_GiaoDichDAL();
            Entities.tbHinhThuc_GiaoDichEntities.tbHinhThuc_GiaoDichColection HTGDCollection = HTGDDAL.Get("where " + Entities.tbHinhThuc_GiaoDichEntities.tbHinhThuc_GiaoDichColumn.MaGD.ToString() + "=" + iD.ToString(), 0, 0, Entities.tbHinhThuc_GiaoDichEntities.tbHinhThuc_GiaoDichColumn.MaGD.ToString(), "ASC", out total);
            if (HTGDCollection.Count > 0)
                return HTGDCollection[0];
            return null;
        }
    }
}
